package offer;

public class offer58 {
}
class Solution58 {
    public static String reverseLeftWords(String s, int n) {

        char [] c = s.toCharArray();
         reverse(c,0,n-1);
         reverse(c,n,c.length-1);
         reverse(c,0, c.length-1);
         String s1 = new String(c);
        return s1;
    }
    public static void reverse(char [] c,int i,int j)
    {  while (i<j) {
        char temp = c[i];
        c[i] = c[j];
        c[j] = temp;
        i++;
        j--;
      }
    }

    public static void main(String[] args) {
        String s = "abcdefg";
        String s1 = reverseLeftWords(s, 2);

    }
}